<?php
//对地址栏那个ID的留言进行修改
require 'dbcon.php';
$id=isset($_GET['id'])?$_GET['id']:0;
$username=$_REQUEST['username'];//获取用户呢称
 $sex=$_REQUEST['sex'];
 $message=$_REQUEST['message'];
 $imgurl=$_REQUEST['imgurl'];// 获取用户留言
$sql="update t_message set username='{$username}',sex='{$sex}',message='{$message}',imgurl='{$imgurl}' where id={$id}";
$rs=$db->query($sql);//执行SQL语句
 if  ($rs==true)
 {
    echo "<script language='javascript' type='text/javascript'>"; 
    //echo "alert('留言成功！');";
    echo "window.location.href='index.php';";
    echo "</script>";
 }
 else {
    echo "<script language='javascript' type='text/javascript'>"; 
    echo "alert('修改失败！');";
    echo "window.location.href='index.php';";
    echo "</script>";
}

$db->close();


